home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / Misc / Display Info Test < prev    next >
Encoding:
Text File  |  1999-03-04  |  2.5 KB  |  78 lines  |  [TEXT/ToyS]

  1. property kasLocation : {0, 0} -- Start location of 0,0 centers the window initially
  2. property kasFlocation : {0, 0} -- Start location of 0,0 centers the window initially
  3.  
  4. -- Some 16-bit colors
  5. property kFullRed16 : (31 * 1024) -- (0-31) * 1024 for red component
  6. property kFullGreen16 : (31 * 32) -- (0-31) * 32 for green component
  7. property kFullBlue16 : 31 -- 0-31 for blue component
  8.  
  9. property kMediumRed16 : (23 * 1024)
  10. property kMediumGreen16 : (23 * 32)
  11. property kMediumBlue16 : 23
  12.  
  13. property kMediumPurple16 : kMediumRed16 + kMediumBlue16
  14.  
  15. property kDarkRed16 : (15 * 1024)
  16. property kDarkGreen16 : (15 * 32)
  17. property kDarkBlue16 : 15
  18.  
  19. property kasTimeHHMMSS : 7 * (16 ^ 0) + 14 * (16 ^ 1) + 9 * (16 ^ 2) + 14 * (16 ^ 3) + 10 * (16 ^ 4) -- "HH:MM:SS" for Akua Data
  20.  
  21.  
  22. global gasInfo -- Our info window
  23. global gasFloat -- Our floating window
  24. global gasCount -- A li'l counter
  25. global gasInitSecs -- The seconds we started at
  26.  
  27.  
  28. on run
  29.     set gasCount to 0
  30.     set gasInitSecs to (pause for 0 with seconds timing)
  31.     
  32.     -- Create an info window (use empty title have title bar on left)
  33.     set gasInfo to display info titled ¬
  34.         "Akua's Display Info" message ¬
  35.         "This is an info test!" located at kasLocation -- Default is line 1
  36.     
  37.     -- Create an info window (use empty title have title bar on left)
  38.     set gasFloat to display info titled ¬
  39.         ("Floating Info @ " & (the clock using format kasTimeHHMMSS)) message ¬
  40.         "This is a floater test!" located at kasFlocation ¬
  41.         with flotation -- Default is line 1
  42.     
  43.     -- Notice that line 2 in idle is inserted before this line
  44.     display info gasInfo message ¬
  45.         "This is line 4" at line 4 using color kMediumGreen16 ¬
  46.         using font "Chicago" using size 12
  47.     
  48.     display info gasFloat message ¬
  49.         "This is line 5" at line 5 using color kDarkBlue16 ¬
  50.         using font "Chicago" using size 12
  51. end run
  52.  
  53.  
  54. on quit
  55.     -- Close our windows
  56.     display info gasInfo with disposal
  57.     display info gasFloat with disposal
  58.     continue quit
  59. end quit
  60.  
  61.  
  62. on idle
  63.     set gasCount to gasCount + 1
  64.     
  65.     -- Preserve window location in kasLocation if it is moved
  66.     set kasLocation to screen location of ¬
  67.         (display info gasInfo message ("We've been idled: " & gasCount & " times") ¬
  68.             at line 2 using color kMediumPurple16)
  69.     
  70.     set difSecs to ((pause for 0 with seconds timing) - gasInitSecs) as integer
  71.     
  72.     set kasFlocation to screen location of ¬
  73.         (display info gasFloat message ("We've been floating for: " & difSecs & " seconds") ¬
  74.             at line 3 using color kMediumRed16)
  75.     
  76.     return 1 -- Idle me every second (this should cause first to lines to become permanent, whilst the updated line remains dynamic)
  77. end idle
  78.